import requests from "./request";
import mockrequests from "./mock";
export const reqCategoryList = () => {
  return requests({
    url: "/product/getBaseCategoryList",
    method: "get",
  });
};

export const reqbannerList = () => {
  return mockrequests({
    url: "/banner",
    method: "get",
  });
};

export const reqfloorList = () => {
  return mockrequests({
    url: "/floor",
    method: "get",
  });
};

export const reqsearchList = (params) => {
  return requests({
    url: "/list",
    method: "post",
    data: params,
  });
};

export const reqgetDetailList = (skuId) =>
  requests({ url: `/item/${skuId}`, method: "get" });

export const reqAddorUpdataShopCartList = (skuId, skuNum) =>
  requests({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: "post",
  });

export const reqShopCarList = () =>
  requests({ url: `/cart/cartList`, method: "get" });

export const reqRemveCart = (skuId) =>
  requests({
    url: `/cart/deleteCart/${skuId}`,
    method: "delete",
  });
// /cart/checkCart/{skuID}/{isChecked}

export const reqChecked = (skuID, isChecked) =>
  requests({
    url: `/cart/checkCart/${skuID}/${isChecked}`,
    method: "get",
  });

export const reqGetCode = (phone) =>
  requests({ url: `/user/passport/sendCode/${phone}`, method: "get" });

export const reqGetRegister = (data) =>
  requests({ url: `/user/passport/register`, method: "post", data });

export const reqLogin = (data) =>
  requests({
    url: `/user/passport/login`,
    method: "post",
    data,
  });
export const reqGetRegisterInfot = () =>
  requests({ url: "/user/passport/auth/getUserInfo", method: "get" });

export const reqLoginout = () =>
  requests({ url: "/user/passport/logout", method: "get" });

export const reqGetTrade = () =>
  requests({ url: "/order/auth/trade", method: "get" });
export const reqAddress = () =>
  requests({
    url: "/user/userAddress/auth/findUserAddressList",
    method: "get",
  });

export const reqOrderInfo = (tradeNo, data) =>
  requests({
    url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
    method: "post",
    data,
  });

export const reqGetPayInfo = (orderId) =>
  requests({ url: `/payment/weixin/createNative/${orderId}`, method: "get" });

export const reqPay = (orderId) =>
  requests({
    url: `/payment/weixin/queryPayStatus/${orderId}`,
    method: "get",
  });

export const reqMyOrder = (page, limit) =>
  requests({ url: `/order/auth/${page}/${limit}`, method: "get" });
